package com.hospital.hospitalsystem.base;

import java.io.Serializable;

public class BaseResponse<T> implements Serializable {
    private T data;
    private int code;
    private String description;

    public BaseResponse() {
    }

    public static BaseResponse success(){
        BaseResponse tmp = new BaseResponse();
        tmp.code = ResultCode.SUCCESS.getCode();
        tmp.description = ResultCode.SUCCESS.getMassage();
        return tmp;
    }

    public static <T>BaseResponse<T> success(T data){
        BaseResponse<T> tmp = new BaseResponse();
        tmp.setData(data);
        tmp.setCode(ResultCode.SUCCESS.getCode());
        tmp.setDescription(ResultCode.SUCCESS.getMassage());
        return tmp;
    }

    public static <T>BaseResponse<T> success(String string){
        BaseResponse<T> tmp = new BaseResponse();
        tmp.setCode(ResultCode.SUCCESS.getCode());
        tmp.setDescription(string);
        return tmp;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
